package jedicourse.jduplessy.exercisesChapter5.core;
import java.util.Scanner;
/**
 * 
 * @author jd09008
 * # exercise 5.2
 *
 */


public class DolarConversor {
	
	private static double valorDolar = 8.2;
	
	public static void main (String[] args) throws Exception{
		
		 double amount;
		 String currency;
		 Scanner in = new Scanner(System.in); 
				 
		 try {
			 
			 System.out.println("To convert Pesos-->Dolar press 1.");			 
			 System.out.println("To convert Dolar-->Pesos press 2.");
			 
			 int option = in.nextInt();			 
			 if (option==1){
				 currency="peso";
			 }else{
				 currency="dolar";
			 }
		 			 
		 	 System.out.print("Enter the amount in "+currency+": "); 
		 	 amount = in.nextInt();
			 
			 if (option==1){			 
				 System.out.println(amount+" pesos are equal to "+(amount=amount/valorDolar)+"dolars");
			 }else if(option==2){
				 System.out.println(amount+" dolars are equal to "+(amount=amount*valorDolar)+"pesos");
			 } else {
				 System.out.println("you choose a wrong option");
			 }
			 
		} catch (Exception e) {
			e.printStackTrace();
		}
		
	}

}
